home *** CD-ROM | disk | FTP | other *** search
- //teststr.cpp -- simple test routine for GetPrivateProfileString
- #include "profiles.h"
- #include <string.h>
- #include <iostream.h>
-
-
- void main()
- {
- char app[81];
- char key[81];
- char out[600];
- char *s ;
- int no ;
- //-- part one , test getting all keys for an application
- cout << "This test uses file test.ini\n";
- cout << "Application -> all keys :" ;
- cin.get(app,sizeof(app));
- cin.ignore();
-
- no = GetPrivateProfileString
- (app,NULL,NULL,out,600,"test.ini");
- cout << "no : " << no << "\n";
- s = out ;
- while (*s)
- {
- cout << " str : " << s << "\n" ;
- s +=strlen(s)+1;
- }
- //-- part two, repeatedly test getting a specific key
- for (;;)
- {
- cout << "Application :";
- cin.get(app,sizeof(app));
- cin.ignore();
- cout << "Key :";
- cin.get(key,sizeof(key)) ;
- cin.ignore();
- no = GetPrivateProfileString
- (app,key,"Default",out,81,"test.ini");
- cout << "no : " << no << " str : " << out << "\n" ;
- }
- }
-
- //-- end of teststr.cpp